package com.zbs.framework.swagger.entity.eolink;

import lombok.Data;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@Data
public class EolinkApiModel {
    private BaseInfoModel baseInfo;
    private List<String> responseHeader;
    private List<String> headerInfo;
    private AuthInfo authInfo;
    private List<ParamInfo> requestInfo;
    private List<String> urlParam;
    private List<String> restfulParam;
    private List<ParamInfo> resultInfo;
    private Integer resultParamJsonType;
    private Integer resultParamType;
    private String structureID;
    private String databaseFieldID;
    private String globalStructureID;
    private String fileID;
    private List<String> requestParamSetting;
    private List<String> resultParamSetting;
    private CustomInfo customInfo;
    private List<MockExpectation> mockExpectationList;
    private Integer soapVersion;
    private List<Integer> tagID;
    private List<Integer> testCastList;
    private Integer apiManagerID;
    private Integer createUserID;
    private Integer updateUserID;
    private Integer apiID;
    private String apiType;
    private String groupName;
    private Integer swaggerID;

    public EolinkApiModel(String groupName,BaseInfoModel baseInfoModel,List<ParamInfo> requestInfo,List<ParamInfo> resultInfo) {
        this.baseInfo = baseInfoModel;
        this.responseHeader = new ArrayList<>();
        this.headerInfo = new ArrayList<>();
        this.authInfo = AuthInfo.build();
        this.requestInfo = requestInfo;
        this.urlParam = new ArrayList<>();
        this.restfulParam = new ArrayList<>();
        this.resultInfo = resultInfo;
        this.resultParamJsonType = 0;
        this.resultParamType = 0;
        this.structureID = "[]";
        this.databaseFieldID = "[]";
        this.globalStructureID = "[]";
        this.fileID = "";
        this.requestParamSetting = new ArrayList<>();
        this.resultParamSetting = new ArrayList<>();
        this.customInfo = CustomInfo.build();
        this.mockExpectationList = Collections.singletonList(new MockExpectation());
        this.soapVersion = null;
        this.tagID = new ArrayList<>();
        this.testCastList = new ArrayList<>();
        this.apiManagerID = 172181;
        this.createUserID = 172181;
        this.updateUserID = 172181;
        this.apiID = (int)(Math.random()*9+1)*1000000;
        this.apiType = "http";
        this.swaggerID = null;
        this.groupName = groupName;
    }

    public static EolinkApiModel build(String groupName,BaseInfoModel baseInfoModel,List<ParamInfo> requestInfo,List<ParamInfo> resultInfo) {
        return  new EolinkApiModel(groupName,baseInfoModel, requestInfo, resultInfo);
    }
}
